﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using GameStudio.IDE.Common;

namespace GameStudio.IDE.Controls
{
    public class OpenProjectcontrol
    {
        public OpenProjectcontrol()
        {
            OpenFileDialog open = new OpenFileDialog();
            open.Filter = "All files (*.*)|*.*|Xml (*.xml)|*.xml";
            DialogResult result = open.ShowDialog();

            if (result==DialogResult.OK)//HasValue && result.Value)
            {
                // Program.EventAggregator.GetEvent<FileOpenEvent>().Publish(open.FileName);

                string path = open.FileName;
                Session.CurrentProject = GameStudio.Common.Serilization.SerilizationHelper.DeSerialize
                     (Session.CurrentProject, path);// -->error

            }
        }
    }
}
